<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel app\models\search\ClientSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Clients';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="client-index">

    <p>
        <?= Html::a('Create Client', ['create'], ['class' => 'btn btn-success']) ?>
    </p>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            'client_id',
//            'client_name',
//            'client_password',
            'client_appkey',
             'is_active',
            // 'created_time',
            // 'qqnumber',
            // 'lastlogintime',
            [
                'attribute' => 'begindate',
                'value' => function($data){
                    return $data->begindate ==0 ? 0 : date('Y-m-d',$data->begindate);
                }
            ],
            [
                'attribute' => 'enddate',
                'value' => function($data){
                    return $data->enddate ==0 ? 0 : date('Y-m-d',$data->enddate);
                }
            ],
            [
                'attribute' => 'add_time',
                'format' => ['date','php:Y-m-d']
            ],
            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>
</div>
